package com.vchello.service.impl.security;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.vchello.bean.security.Role;
import com.vchello.dao.security.RoleDao;
import com.vchello.service.security.RoleService;

/**
 * 
 * @author power
 *
 */
@Service(value = "roleService")
public class RoleServiceImpl extends ServiceImpl<RoleDao, Role> implements RoleService {
	
	@Autowired
	private RoleDao roleDao;

	@Override
	public List<Role> findRoleByUserId(int userId) {
		return roleDao.findRoleByUserId(userId);
	}

	@Override
	public boolean saveRole(Role role) {
		return roleDao.saveRole(role);
	}

	@Override
	public Role findByOne(int id) {
		return roleDao.findByOne(id);
	}

	@Override
	public boolean updateRole(Role role) {
		return roleDao.updateRole(role);
	}

	@Override
	public boolean deleteRole(Role role) {
		try {
			roleDao.deleteRole(role);
			return true;
		} catch (Exception e) {
			// TODO: handle exception
		}
		return false;
	}

}
